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

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

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

b = A("b")
h = B("h")
i = C("i")
f = A("f")
m = B("m")
n = B("n")
k = C("k")
c = C("c")
e = A("e")
a = A("a")

b.r = f
b.w = i
b.t = c
h.x = c
i.z = k
i.t = m
f.r = b
f.w = c
f.t = i
m.x = i
n.x = k
k.z = c
k.t = n
c.z = k
c.t = m
e.r = f
e.w = c
e.t = i
a.r = e
a.w = k
a.t = i
assert f.w.z.z.z.z.z.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: C = None
        self.t: C = None
        self.txt = txt

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

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

b = A("b")
h = B("h")
i = C("i")
f = A("f")
m = B("m")
n = B("n")
k = C("k")
c = C("c")
e = A("e")
a = A("a")

b.r = f
b.w = i
b.t = c
h.x = c
i.z = k
i.t = m
f.r = b
f.w = c
f.t = i
m.x = i
n.x = k
k.z = c
k.t = n
c.z = k
c.t = m
e.r = f
e.w = c
e.t = i
a.r = e
a.w = k
a.t = i
assert f.w.z.z.z.z.z.t.x.txt == "k"