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

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

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

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

l = A("l")
k = B("k")
h = C("h")
b = D("b")
c = D("c")
j = B("j")
i = A("i")
e = B("e")
a = C("a")
g = B("g")

l.z = h
l.s = a
k.v = a
h.x = g
h.q = k
h.z = b
b.v = h
b.p = a
b.o = i
b.s = c
c.v = a
c.p = a
c.o = l
c.s = b
j.v = a
i.z = a
i.s = h
e.v = a
a.x = j
a.q = e
a.z = c
g.v = h
assert c.p.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
h = C("h")
b = D("b")
c = D("c")
j = B("j")
i = A("i")
e = B("e")
a = C("a")
g = B("g")

l.z = h
l.s = a
k.v = a
h.x = g
h.q = k
h.z = b
b.v = h
b.p = a
b.o = i
b.s = c
c.v = a
c.p = a
c.o = l
c.s = b
j.v = a
i.z = a
i.s = h
e.v = a
a.x = j
a.q = e
a.z = c
g.v = h
assert c.p.x.v.txt == "a"