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

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

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

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

c = A("c")
k = B("k")
d = C("d")
n = D("n")
b = B("b")
j = D("j")
a = D("a")
l = A("l")

c.z = d
c.w = b
c.q = k
k.u = j
d.y = j
d.u = b
n.z = j
n.x = j
n.q = d
n.p = c
b.u = j
j.z = n
j.x = n
j.q = d
j.p = l
a.z = n
a.x = n
a.q = d
a.p = c
l.z = d
l.w = k
l.q = b
assert c.q.u.q.u.u.q.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: B = None
        self.q: B = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
d = C("d")
n = D("n")
b = B("b")
j = D("j")
a = D("a")
l = A("l")

c.z = d
c.w = b
c.q = k
k.u = j
d.y = j
d.u = b
n.z = j
n.x = j
n.q = d
n.p = c
b.u = j
j.z = n
j.x = n
j.q = d
j.p = l
a.z = n
a.x = n
a.q = d
a.p = c
l.z = d
l.w = k
l.q = b
assert c.q.u.q.u.u.q.u.u.txt == "j"