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

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

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

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

l = A("l")
h = B("h")
k = C("k")
d = D("d")
i = A("i")
b = C("b")
g = C("g")
c = D("c")
j = B("j")

l.t = d
l.q = d
l.z = j
h.z = j
h.q = l
k.q = b
k.s = b
k.x = j
d.r = h
d.u = h
d.x = b
i.t = d
i.q = c
i.z = h
b.q = k
b.s = g
b.x = j
g.q = b
g.s = k
g.x = h
c.r = j
c.x = g
c.u = h
j.z = h
j.q = l
assert b.x.z.q.z.z.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: D = None
        self.z: B = None
        self.txt = txt

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

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

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

l = A("l")
h = B("h")
k = C("k")
d = D("d")
i = A("i")
b = C("b")
g = C("g")
c = D("c")
j = B("j")

l.t = d
l.q = d
l.z = j
h.z = j
h.q = l
k.q = b
k.s = b
k.x = j
d.r = h
d.u = h
d.x = b
i.t = d
i.q = c
i.z = h
b.q = k
b.s = g
b.x = j
g.q = b
g.s = k
g.x = h
c.r = j
c.x = g
c.u = h
j.z = h
j.q = l
assert b.x.z.q.z.z.q.z.q.txt == "l"