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

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

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

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

j = A("j")
k = B("k")
a = C("a")
f = D("f")
m = A("m")
b = A("b")
e = B("e")
n = D("n")

j.p = b
j.z = n
k.w = b
k.v = f
k.z = j
a.t = b
a.r = b
f.y = e
f.u = a
f.r = b
m.p = j
m.z = f
b.p = m
b.z = f
e.w = b
e.z = b
e.v = f
n.y = e
n.u = a
n.r = j
assert a.t.p.p.z.u.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: D = None
        self.txt = txt

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

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

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

j = A("j")
k = B("k")
a = C("a")
f = D("f")
m = A("m")
b = A("b")
e = B("e")
n = D("n")

j.p = b
j.z = n
k.w = b
k.v = f
k.z = j
a.t = b
a.r = b
f.y = e
f.u = a
f.r = b
m.p = j
m.z = f
b.p = m
b.z = f
e.w = b
e.z = b
e.v = f
n.y = e
n.u = a
n.r = j
assert a.t.p.p.z.u.t.z.txt == "f"