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

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

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

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

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

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

i.o = l
i.v = m
m.p = d
a.t = m
a.v = d
l.x = k
l.q = a
l.p = d
c.z = k
c.x = k
c.r = k
c.v = l
e.z = m
e.x = m
e.r = k
e.v = l
k.p = d
d.t = k
d.v = a
h.o = l
h.v = m
g.o = l
g.v = m
assert d.t.p.t.p.v.v.t.p.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

i.o = l
i.v = m
m.p = d
a.t = m
a.v = d
l.x = k
l.q = a
l.p = d
c.z = k
c.x = k
c.r = k
c.v = l
e.z = m
e.x = m
e.r = k
e.v = l
k.p = d
d.t = k
d.v = a
h.o = l
h.v = m
g.o = l
g.v = m
assert d.t.p.t.p.v.v.t.p.v.v.txt == "d"