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

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

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

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

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

m.o = g
m.t = j
m.p = l
m.u = l
e.q = d
e.w = d
e.o = g
d.w = c
g.v = c
b.w = c
a.w = c
l.v = i
j.o = l
j.u = l
j.t = m
j.p = g
i.q = a
i.w = a
i.o = g
c.q = b
c.w = b
c.o = g
assert l.v.w.w.w.w.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: A = None
        self.p: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

m.o = g
m.t = j
m.p = l
m.u = l
e.q = d
e.w = d
e.o = g
d.w = c
g.v = c
b.w = c
a.w = c
l.v = i
j.o = l
j.u = l
j.t = m
j.p = g
i.q = a
i.w = a
i.o = g
c.q = b
c.w = b
c.o = g
assert l.v.w.w.w.w.o.v.txt == "c"