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

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

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

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

f = A("f")
d = B("d")
e = C("e")
k = D("k")
l = A("l")
m = A("m")
h = A("h")
a = A("a")
n = D("n")

f.p = e
f.z = h
f.t = d
d.v = k
e.y = d
e.p = k
k.u = d
l.p = e
l.z = f
l.t = d
m.p = e
m.z = a
m.t = d
h.p = e
h.z = a
h.t = d
a.p = e
a.z = l
a.t = d
n.u = d
assert k.u.v.u.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: A = None
        self.t: B = None
        self.txt = txt

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

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

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

f = A("f")
d = B("d")
e = C("e")
k = D("k")
l = A("l")
m = A("m")
h = A("h")
a = A("a")
n = D("n")

f.p = e
f.z = h
f.t = d
d.v = k
e.y = d
e.p = k
k.u = d
l.p = e
l.z = f
l.t = d
m.p = e
m.z = a
m.t = d
h.p = e
h.z = a
h.t = d
a.p = e
a.z = l
a.t = d
n.u = d
assert k.u.v.u.v.u.v.txt == "k"