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

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

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

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

j = A("j")
b = B("b")
k = C("k")
l = D("l")
h = B("h")
e = A("e")
a = A("a")
c = A("c")

j.t = l
j.x = h
j.p = b
b.v = k
b.s = j
b.z = h
b.u = h
k.u = c
k.q = e
k.p = a
k.v = h
l.t = e
h.v = k
h.s = c
h.z = b
h.u = b
e.t = l
e.x = h
e.p = h
a.t = l
a.x = h
a.p = b
c.t = l
c.x = b
c.p = b
assert c.t.t.t.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
k = C("k")
l = D("l")
h = B("h")
e = A("e")
a = A("a")
c = A("c")

j.t = l
j.x = h
j.p = b
b.v = k
b.s = j
b.z = h
b.u = h
k.u = c
k.q = e
k.p = a
k.v = h
l.t = e
h.v = k
h.s = c
h.z = b
h.u = b
e.t = l
e.x = h
e.p = h
a.t = l
a.x = h
a.p = b
c.t = l
c.x = b
c.p = b
assert c.t.t.t.t.p.txt == "h"