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

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

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

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

c = A("c")
k = B("k")
e = C("e")
m = D("m")
j = C("j")
l = A("l")
n = D("n")

c.u = k
c.t = k
c.q = n
k.z = c
k.s = e
e.p = j
m.y = j
m.w = l
j.p = e
l.u = k
l.t = k
l.q = n
n.y = j
n.w = l
assert l.q.y.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: D = None
        self.t: B = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
e = C("e")
m = D("m")
j = C("j")
l = A("l")
n = D("n")

c.u = k
c.t = k
c.q = n
k.z = c
k.s = e
e.p = j
m.y = j
m.w = l
j.p = e
l.u = k
l.t = k
l.q = n
n.y = j
n.w = l
assert l.q.y.p.p.p.p.txt == "j"