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

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

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

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

h = A("h")
a = B("a")
i = C("i")
j = D("j")
n = A("n")
c = C("c")
f = D("f")
m = D("m")
k = B("k")
l = C("l")

h.p = n
a.w = j
a.q = k
a.t = f
a.u = c
i.v = l
j.q = c
j.x = a
j.u = k
n.p = h
c.v = i
f.q = c
f.x = k
f.u = a
m.q = c
m.x = a
m.u = k
k.w = j
k.q = a
k.t = m
k.u = i
l.v = c
assert n.p.p.p.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

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

h = A("h")
a = B("a")
i = C("i")
j = D("j")
n = A("n")
c = C("c")
f = D("f")
m = D("m")
k = B("k")
l = C("l")

h.p = n
a.w = j
a.q = k
a.t = f
a.u = c
i.v = l
j.q = c
j.x = a
j.u = k
n.p = h
c.v = i
f.q = c
f.x = k
f.u = a
m.q = c
m.x = a
m.u = k
k.w = j
k.q = a
k.t = m
k.u = i
l.v = c
assert n.p.p.p.p.p.p.p.p.p.txt == "h"