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

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

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

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

c = A("c")
l = B("l")
b = C("b")
g = D("g")
j = A("j")
m = C("m")
d = B("d")
a = A("a")

c.z = m
c.s = l
c.o = l
c.p = b
l.q = g
l.y = g
l.u = d
l.t = b
b.o = j
b.y = g
g.o = l
g.r = b
j.z = b
j.p = b
j.s = d
j.o = l
m.o = j
m.y = g
d.q = g
d.y = g
d.u = l
d.t = m
a.z = m
a.s = l
a.o = l
a.p = b
assert l.u.q.o.t.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.o: B = None
        self.p: C = None
        self.txt = txt

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

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

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

c = A("c")
l = B("l")
b = C("b")
g = D("g")
j = A("j")
m = C("m")
d = B("d")
a = A("a")

c.z = m
c.s = l
c.o = l
c.p = b
l.q = g
l.y = g
l.u = d
l.t = b
b.o = j
b.y = g
g.o = l
g.r = b
j.z = b
j.p = b
j.s = d
j.o = l
m.o = j
m.y = g
d.q = g
d.y = g
d.u = l
d.t = m
a.z = m
a.s = l
a.o = l
a.p = b
assert l.u.q.o.t.o.o.txt == "l"