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

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

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

d = A("d")
a = B("a")
e = C("e")
h = B("h")
f = C("f")
m = B("m")
g = B("g")
j = A("j")
k = C("k")

d.t = j
d.o = k
a.z = f
a.u = f
a.t = j
e.r = j
e.t = d
h.z = f
h.u = f
h.t = d
f.r = d
f.t = d
m.z = f
m.t = j
m.u = e
g.z = e
g.t = j
g.u = k
j.t = d
j.o = e
k.r = j
k.t = d
assert f.t.t.o.r.o.t.o.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

d = A("d")
a = B("a")
e = C("e")
h = B("h")
f = C("f")
m = B("m")
g = B("g")
j = A("j")
k = C("k")

d.t = j
d.o = k
a.z = f
a.u = f
a.t = j
e.r = j
e.t = d
h.z = f
h.u = f
h.t = d
f.r = d
f.t = d
m.z = f
m.t = j
m.u = e
g.z = e
g.t = j
g.u = k
j.t = d
j.o = e
k.r = j
k.t = d
assert f.t.t.o.r.o.t.o.r.t.txt == "d"