class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: B = None
        self.z: A = 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.x: C = None
        self.txt = txt

f = A("f")
a = B("a")
i = C("i")
b = B("b")
g = B("g")
j = A("j")
m = C("m")
l = B("l")
n = C("n")
d = B("d")

f.w = j
f.z = j
f.q = g
a.u = g
i.x = n
b.u = a
g.u = b
j.w = f
j.z = f
j.q = b
m.x = i
l.u = g
n.x = i
d.u = a
assert a.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: B = None
        self.z: A = 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.x: C = None
        self.txt = txt

f = A("f")
a = B("a")
i = C("i")
b = B("b")
g = B("g")
j = A("j")
m = C("m")
l = B("l")
n = C("n")
d = B("d")

f.w = j
f.z = j
f.q = g
a.u = g
i.x = n
b.u = a
g.u = b
j.w = f
j.z = f
j.q = b
m.x = i
l.u = g
n.x = i
d.u = a
assert a.u.u.u.u.u.u.u.txt == "g"