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

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

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

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

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

a.z = e
h.v = l
h.p = c
h.w = c
h.u = i
d.t = e
d.r = k
d.o = a
k.q = h
k.s = i
k.v = i
k.y = a
c.v = b
c.p = h
c.w = h
c.u = d
e.z = a
i.t = e
i.o = e
i.r = b
l.q = c
l.s = i
l.y = a
l.v = d
b.q = h
b.s = d
b.y = a
b.v = i
assert c.u.r.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

a.z = e
h.v = l
h.p = c
h.w = c
h.u = i
d.t = e
d.r = k
d.o = a
k.q = h
k.s = i
k.v = i
k.y = a
c.v = b
c.p = h
c.w = h
c.u = d
e.z = a
i.t = e
i.o = e
i.r = b
l.q = c
l.s = i
l.y = a
l.v = d
b.q = h
b.s = d
b.y = a
b.v = i
assert c.u.r.q.p.txt == "c"