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

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

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

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

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

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

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

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

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

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

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