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

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

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

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

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

j.t = k
j.v = d
j.r = e
j.z = l
c.x = k
c.q = l
d.p = e
d.v = l
l.o = k
l.y = i
l.q = j
b.o = k
b.y = l
b.q = j
e.p = d
e.v = l
k.x = c
k.q = i
i.o = k
i.y = b
i.q = j
assert k.x.x.x.q.q.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

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

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

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

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

j.t = k
j.v = d
j.r = e
j.z = l
c.x = k
c.q = l
d.p = e
d.v = l
l.o = k
l.y = i
l.q = j
b.o = k
b.y = l
b.q = j
e.p = d
e.v = l
k.x = c
k.q = i
i.o = k
i.y = b
i.q = j
assert k.x.x.x.q.q.r.p.txt == "d"