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

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

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

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

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

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

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

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

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