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

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

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

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

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

m.q = l
m.o = l
m.u = f
m.p = j
j.s = f
j.v = f
j.r = c
c.r = f
c.q = f
c.x = m
f.t = j
f.y = c
l.q = m
l.o = m
l.u = f
l.p = j
assert l.q.p.r.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: D = None
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

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

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

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

m.q = l
m.o = l
m.u = f
m.p = j
j.s = f
j.v = f
j.r = c
c.r = f
c.q = f
c.x = m
f.t = j
f.y = c
l.q = m
l.o = m
l.u = f
l.p = j
assert l.q.p.r.q.y.txt == "c"