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

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

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

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

a = A("a")
i = B("i")
h = C("h")
n = D("n")
g = B("g")
k = A("k")
b = C("b")
l = C("l")

a.u = l
i.t = h
h.s = g
h.t = n
h.r = i
h.q = b
n.v = g
n.z = k
n.x = l
g.t = l
k.u = b
b.s = i
b.t = n
b.r = g
b.q = h
l.s = g
l.r = g
l.t = n
l.q = b
assert l.q.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

a = A("a")
i = B("i")
h = C("h")
n = D("n")
g = B("g")
k = A("k")
b = C("b")
l = C("l")

a.u = l
i.t = h
h.s = g
h.t = n
h.r = i
h.q = b
n.v = g
n.z = k
n.x = l
g.t = l
k.u = b
b.s = i
b.t = n
b.r = g
b.q = h
l.s = g
l.r = g
l.t = n
l.q = b
assert l.q.s.t.txt == "h"