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

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

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

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

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

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

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

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

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

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

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