class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: D = None
        self.u: C = None
        self.p: 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.o: C = None
        self.z: C = None
        self.p: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: D = None
        self.txt = txt

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

e.x = l
e.t = g
e.u = d
e.p = k
l.x = d
k.o = d
k.z = d
k.p = d
g.q = h
g.z = m
m.q = e
m.z = g
h.x = l
h.t = g
h.u = d
h.p = k
a.x = d
d.o = k
d.z = k
d.p = k
j.x = l
j.t = g
j.u = k
j.p = k
assert k.o.o.p.p.p.z.p.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: D = None
        self.u: C = None
        self.p: 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.o: C = None
        self.z: C = None
        self.p: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: D = None
        self.txt = txt

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

e.x = l
e.t = g
e.u = d
e.p = k
l.x = d
k.o = d
k.z = d
k.p = d
g.q = h
g.z = m
m.q = e
m.z = g
h.x = l
h.t = g
h.u = d
h.p = k
a.x = d
d.o = k
d.z = k
d.p = k
j.x = l
j.t = g
j.u = k
j.p = k
assert k.o.o.p.p.p.z.p.z.p.txt == "d"