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

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

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

d = A("d")
k = B("k")
a = C("a")
i = A("i")
e = C("e")
f = B("f")
b = B("b")
c = A("c")
l = B("l")

d.q = e
d.x = l
k.u = a
a.y = e
a.t = e
a.x = k
i.q = a
i.x = b
e.y = a
e.t = a
e.x = k
f.u = a
b.u = a
c.q = e
c.x = l
l.u = e
assert i.x.u.x.u.y.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: B = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
a = C("a")
i = A("i")
e = C("e")
f = B("f")
b = B("b")
c = A("c")
l = B("l")

d.q = e
d.x = l
k.u = a
a.y = e
a.t = e
a.x = k
i.q = a
i.x = b
e.y = a
e.t = a
e.x = k
f.u = a
b.u = a
c.q = e
c.x = l
l.u = e
assert i.x.u.x.u.y.x.u.x.txt == "k"