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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: A = None
        self.o: D = None
        self.t: D = None
        self.txt = txt

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

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

f.z = l
f.q = a
f.w = a
f.r = n
j.r = n
j.u = a
j.y = f
n.u = a
n.o = a
n.v = l
n.t = c
a.z = j
a.r = n
l.z = f
l.q = a
l.r = n
l.w = c
c.z = j
c.r = n
e.z = f
e.q = a
e.w = a
e.r = n
k.z = e
k.q = a
k.r = n
k.w = c
assert j.r.v.w.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: D = None
        self.r: C = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: A = None
        self.o: D = None
        self.t: D = None
        self.txt = txt

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

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

f.z = l
f.q = a
f.w = a
f.r = n
j.r = n
j.u = a
j.y = f
n.u = a
n.o = a
n.v = l
n.t = c
a.z = j
a.r = n
l.z = f
l.q = a
l.r = n
l.w = c
c.z = j
c.r = n
e.z = f
e.q = a
e.w = a
e.r = n
k.z = e
k.q = a
k.r = n
k.w = c
assert j.r.v.w.z.u.txt == "a"