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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: C = None
        self.r: A = None
        self.txt = txt

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

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

g.u = j
g.x = j
g.w = a
d.y = e
d.r = e
d.o = j
b.t = a
l.t = j
j.t = f
e.u = b
e.x = b
e.w = a
f.t = b
m.u = l
m.w = b
m.x = a
a.t = f
assert l.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: C = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: C = None
        self.r: A = None
        self.txt = txt

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

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

g.u = j
g.x = j
g.w = a
d.y = e
d.r = e
d.o = j
b.t = a
l.t = j
j.t = f
e.u = b
e.x = b
e.w = a
f.t = b
m.u = l
m.w = b
m.x = a
a.t = f
assert l.t.t.t.t.txt == "a"