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

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

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

e = A("e")
b = B("b")
m = C("m")
c = C("c")
j = A("j")
h = A("h")
k = A("k")
f = C("f")

e.w = k
e.y = h
e.t = b
b.o = c
b.x = j
m.z = b
m.u = b
m.p = h
c.z = b
c.u = b
c.p = h
j.w = k
j.y = k
j.t = b
h.w = e
h.y = e
h.t = b
k.w = h
k.y = e
k.t = b
f.z = b
f.u = b
f.p = e
assert c.p.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.t: B = None
        self.txt = txt

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

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

e = A("e")
b = B("b")
m = C("m")
c = C("c")
j = A("j")
h = A("h")
k = A("k")
f = C("f")

e.w = k
e.y = h
e.t = b
b.o = c
b.x = j
m.z = b
m.u = b
m.p = h
c.z = b
c.u = b
c.p = h
j.w = k
j.y = k
j.t = b
h.w = e
h.y = e
h.t = b
k.w = h
k.y = e
k.t = b
f.z = b
f.u = b
f.p = e
assert c.p.t.x.txt == "j"