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

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

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

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

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

n.q = h
h.v = c
h.r = j
h.t = a
h.z = n
j.t = l
k.y = h
k.t = j
c.q = a
l.y = h
l.t = j
b.q = a
f.y = h
f.t = j
d.y = h
d.t = j
a.v = b
a.z = b
a.r = j
a.t = h
assert j.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

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

n.q = h
h.v = c
h.r = j
h.t = a
h.z = n
j.t = l
k.y = h
k.t = j
c.q = a
l.y = h
l.t = j
b.q = a
f.y = h
f.t = j
d.y = h
d.t = j
a.v = b
a.z = b
a.r = j
a.t = h
assert j.t.t.t.t.txt == "j"