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

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

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

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

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

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

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

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

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

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

a.z = f
a.x = n
a.r = n
m.y = n
m.u = f
m.p = l
g.t = a
g.p = a
g.x = m
l.x = j
l.w = j
l.y = n
b.y = n
b.u = f
b.p = l
j.x = l
j.w = l
j.y = n
f.y = a
f.u = e
f.p = j
e.y = a
e.u = f
e.p = l
n.z = m
n.x = a
n.r = a
c.t = a
c.p = a
c.x = m
assert n.z.u.u.y.z.p.y.r.r.txt == "n"