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

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

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

d = A("d")
n = B("n")
k = C("k")
h = B("h")
e = A("e")
b = A("b")
j = B("j")
a = B("a")
c = A("c")

d.o = k
d.z = k
n.x = j
k.v = h
h.x = j
e.o = k
e.z = k
b.o = k
b.z = k
j.x = h
a.x = j
c.o = k
c.z = k
assert d.o.v.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.txt = txt

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

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

d = A("d")
n = B("n")
k = C("k")
h = B("h")
e = A("e")
b = A("b")
j = B("j")
a = B("a")
c = A("c")

d.o = k
d.z = k
n.x = j
k.v = h
h.x = j
e.o = k
e.z = k
b.o = k
b.z = k
j.x = h
a.x = j
c.o = k
c.z = k
assert d.o.v.x.x.x.x.x.x.txt == "h"