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

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

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

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

m = A("m")
c = B("c")
i = C("i")
a = D("a")
l = D("l")
f = C("f")

m.v = c
m.w = c
c.u = m
i.r = f
i.w = f
i.y = f
i.q = l
a.o = l
l.o = a
f.r = i
f.w = i
f.y = i
f.q = a
assert f.q.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.txt = txt

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

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

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

m = A("m")
c = B("c")
i = C("i")
a = D("a")
l = D("l")
f = C("f")

m.v = c
m.w = c
c.u = m
i.r = f
i.w = f
i.y = f
i.q = l
a.o = l
l.o = a
f.r = i
f.w = i
f.y = i
f.q = a
assert f.q.o.o.o.o.txt == "a"