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

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

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

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

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

l.o = d
l.q = a
l.v = m
n.t = a
c.o = m
c.y = b
b.x = k
b.y = i
a.t = k
m.o = d
m.y = b
i.x = n
i.y = b
d.o = m
d.y = i
k.t = n
h.o = d
h.y = b
assert l.o.y.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: B = None
        self.v: C = None
        self.txt = txt

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

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

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

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

l.o = d
l.q = a
l.v = m
n.t = a
c.o = m
c.y = b
b.x = k
b.y = i
a.t = k
m.o = d
m.y = b
i.x = n
i.y = b
d.o = m
d.y = i
k.t = n
h.o = d
h.y = b
assert l.o.y.x.t.txt == "a"