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

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

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

a = A("a")
j = B("j")
f = C("f")
b = A("b")
g = C("g")
k = A("k")
n = B("n")
i = C("i")
c = B("c")

a.x = b
j.w = k
j.y = k
j.z = c
f.r = a
f.u = a
f.t = i
b.x = k
g.r = a
g.u = a
g.t = f
k.x = b
n.w = b
n.y = a
n.z = j
i.r = k
i.t = g
i.u = b
c.w = a
c.y = b
c.z = n
assert i.u.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

a = A("a")
j = B("j")
f = C("f")
b = A("b")
g = C("g")
k = A("k")
n = B("n")
i = C("i")
c = B("c")

a.x = b
j.w = k
j.y = k
j.z = c
f.r = a
f.u = a
f.t = i
b.x = k
g.r = a
g.u = a
g.t = f
k.x = b
n.w = b
n.y = a
n.z = j
i.r = k
i.t = g
i.u = b
c.w = a
c.y = b
c.z = n
assert i.u.x.x.x.x.txt == "b"