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

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

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

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

c = A("c")
d = B("d")
m = C("m")
n = D("n")
j = C("j")
e = D("e")
g = A("g")
b = A("b")
l = D("l")

c.r = j
c.u = d
c.p = m
d.t = m
m.z = g
n.w = m
n.v = e
n.t = d
j.z = g
e.w = j
e.v = n
e.t = d
g.r = m
g.u = d
g.p = j
b.r = m
b.u = d
b.p = j
l.w = m
l.v = n
l.t = d
assert c.p.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: B = None
        self.p: C = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
m = C("m")
n = D("n")
j = C("j")
e = D("e")
g = A("g")
b = A("b")
l = D("l")

c.r = j
c.u = d
c.p = m
d.t = m
m.z = g
n.w = m
n.v = e
n.t = d
j.z = g
e.w = j
e.v = n
e.t = d
g.r = m
g.u = d
g.p = j
b.r = m
b.u = d
b.p = j
l.w = m
l.v = n
l.t = d
assert c.p.z.r.txt == "m"