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

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

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

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

l = A("l")
m = B("m")
h = C("h")
d = D("d")
i = C("i")
n = B("n")
j = A("j")
c = D("c")

l.t = c
l.x = j
m.o = j
m.q = j
m.s = i
h.v = c
d.z = l
d.t = m
d.v = m
d.r = m
i.v = c
n.o = j
n.s = h
n.q = l
j.t = c
j.x = l
c.z = l
c.t = m
c.v = m
c.r = n
assert d.t.s.v.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: A = None
        self.txt = txt

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

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

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

l = A("l")
m = B("m")
h = C("h")
d = D("d")
i = C("i")
n = B("n")
j = A("j")
c = D("c")

l.t = c
l.x = j
m.o = j
m.q = j
m.s = i
h.v = c
d.z = l
d.t = m
d.v = m
d.r = m
i.v = c
n.o = j
n.s = h
n.q = l
j.t = c
j.x = l
c.z = l
c.t = m
c.v = m
c.r = n
assert d.t.s.v.r.s.txt == "h"