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

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

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

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

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

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

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

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

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