class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

i.v = n
i.u = n
c.z = d
n.o = a
k.p = e
k.v = a
a.v = e
a.u = n
g.p = n
g.v = a
d.z = c
e.o = a
h.p = e
h.v = a
assert e.o.v.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

i.v = n
i.u = n
c.z = d
n.o = a
k.p = e
k.v = a
a.v = e
a.u = n
g.p = n
g.v = a
d.z = c
e.o = a
h.p = e
h.v = a
assert e.o.v.o.v.o.txt == "a"