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

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

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

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

e = A("e")
j = B("j")
f = C("f")
m = D("m")
i = D("i")
c = B("c")

e.v = f
e.q = j
j.v = e
j.u = f
f.q = i
m.o = i
m.u = i
m.y = c
m.v = f
i.o = m
i.u = m
i.y = c
i.v = f
c.v = e
c.u = f
assert c.v.q.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: B = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
f = C("f")
m = D("m")
i = D("i")
c = B("c")

e.v = f
e.q = j
j.v = e
j.u = f
f.q = i
m.o = i
m.u = i
m.y = c
m.v = f
i.o = m
i.u = m
i.y = c
i.v = f
c.v = e
c.u = f
assert c.v.q.u.q.u.txt == "m"