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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: C = None
        self.txt = txt

j = A("j")
g = B("g")
h = C("h")
c = D("c")
e = C("e")
d = D("d")
a = A("a")
n = A("n")
b = A("b")
m = C("m")

j.t = g
j.u = c
j.x = h
g.z = d
g.r = e
h.t = m
c.r = e
c.y = h
e.t = m
d.r = e
d.y = e
a.t = g
a.u = d
a.x = e
n.t = g
n.u = d
n.x = m
b.t = g
b.u = d
b.x = h
m.t = e
assert e.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: D = None
        self.x: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: C = None
        self.txt = txt

j = A("j")
g = B("g")
h = C("h")
c = D("c")
e = C("e")
d = D("d")
a = A("a")
n = A("n")
b = A("b")
m = C("m")

j.t = g
j.u = c
j.x = h
g.z = d
g.r = e
h.t = m
c.r = e
c.y = h
e.t = m
d.r = e
d.y = e
a.t = g
a.u = d
a.x = e
n.t = g
n.u = d
n.x = m
b.t = g
b.u = d
b.x = h
m.t = e
assert e.t.t.t.t.t.t.txt == "e"