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

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

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

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

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

c.u = n
c.w = e
c.z = l
n.p = c
l.q = n
l.r = n
l.z = e
e.u = c
e.p = n
e.z = l
assert l.q.p.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: D = None
        self.z: C = None
        self.txt = txt

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

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

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

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

c.u = n
c.w = e
c.z = l
n.p = c
l.q = n
l.r = n
l.z = e
e.u = c
e.p = n
e.z = l
assert l.q.p.w.u.txt == "c"