class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: E = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.p: C = None
        self.txt = txt

k = A("k")
e = B("e")
d = C("d")
j = D("j")
m = E("m")
h = B("h")
i = A("i")
b = A("b")

k.p = b
k.q = e
k.o = h
e.y = m
e.v = m
e.u = m
e.z = h
d.p = j
d.o = j
j.t = h
m.s = d
m.x = d
m.p = d
h.y = m
h.v = m
h.u = m
h.z = e
i.p = k
i.q = h
i.o = e
b.p = i
b.q = e
b.o = h
assert k.o.z.y.x.p.t.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: E = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.p: C = None
        self.txt = txt

k = A("k")
e = B("e")
d = C("d")
j = D("j")
m = E("m")
h = B("h")
i = A("i")
b = A("b")

k.p = b
k.q = e
k.o = h
e.y = m
e.v = m
e.u = m
e.z = h
d.p = j
d.o = j
j.t = h
m.s = d
m.x = d
m.p = d
h.y = m
h.v = m
h.u = m
h.z = e
i.p = k
i.q = h
i.o = e
b.p = i
b.q = e
b.o = h
assert k.o.z.y.x.p.t.y.x.txt == "d"