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

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

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

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

i = A("i")
c = B("c")
l = C("l")
g = D("g")
h = D("h")
f = A("f")
j = A("j")
d = C("d")
e = D("e")
n = C("n")

i.u = n
i.z = f
i.y = c
i.t = d
c.p = e
c.x = e
c.w = j
l.t = c
l.u = c
l.p = d
g.y = c
g.p = n
h.y = c
h.p = l
f.u = d
f.t = d
f.z = j
f.y = c
j.u = l
j.z = i
j.y = c
j.t = n
d.t = c
d.u = c
d.p = n
e.y = c
e.p = l
n.t = c
n.u = c
n.p = d
assert n.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: A = None
        self.y: B = None
        self.t: C = None
        self.txt = txt

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

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

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

i = A("i")
c = B("c")
l = C("l")
g = D("g")
h = D("h")
f = A("f")
j = A("j")
d = C("d")
e = D("e")
n = C("n")

i.u = n
i.z = f
i.y = c
i.t = d
c.p = e
c.x = e
c.w = j
l.t = c
l.u = c
l.p = d
g.y = c
g.p = n
h.y = c
h.p = l
f.u = d
f.t = d
f.z = j
f.y = c
j.u = l
j.z = i
j.y = c
j.t = n
d.t = c
d.u = c
d.p = n
e.y = c
e.p = l
n.t = c
n.u = c
n.p = d
assert n.p.p.p.txt == "d"