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

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

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

d = A("d")
k = B("k")
l = C("l")
j = A("j")
n = B("n")
m = A("m")
f = C("f")
b = B("b")

d.u = m
d.y = m
d.t = n
k.x = b
l.o = f
j.u = d
j.y = d
j.t = b
n.x = k
m.u = d
m.y = d
m.t = k
f.o = l
b.x = k
assert m.t.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: A = None
        self.t: B = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
l = C("l")
j = A("j")
n = B("n")
m = A("m")
f = C("f")
b = B("b")

d.u = m
d.y = m
d.t = n
k.x = b
l.o = f
j.u = d
j.y = d
j.t = b
n.x = k
m.u = d
m.y = d
m.t = k
f.o = l
b.x = k
assert m.t.x.x.x.txt == "b"