class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.p: A = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: C = None
        self.txt = txt

k = A("k")
n = B("n")
f = C("f")
l = D("l")
g = A("g")
d = B("d")
e = C("e")

k.q = l
k.x = l
k.t = n
k.p = g
n.x = d
n.u = l
f.p = k
f.x = l
l.t = e
l.y = f
g.q = l
g.x = l
g.t = n
g.p = k
d.x = n
d.u = l
e.p = k
e.x = l
assert f.p.p.p.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.p: A = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: C = None
        self.txt = txt

k = A("k")
n = B("n")
f = C("f")
l = D("l")
g = A("g")
d = B("d")
e = C("e")

k.q = l
k.x = l
k.t = n
k.p = g
n.x = d
n.u = l
f.p = k
f.x = l
l.t = e
l.y = f
g.q = l
g.x = l
g.t = n
g.p = k
d.x = n
d.u = l
e.p = k
e.x = l
assert f.p.p.p.t.u.txt == "l"