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

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

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

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

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

j.p = m
j.v = m
j.u = g
g.r = j
g.u = j
g.s = e
l.q = e
l.w = b
l.o = m
l.y = j
m.s = j
b.r = j
b.u = j
b.s = l
e.q = l
e.w = g
e.o = m
e.y = j
a.r = j
a.u = j
a.s = l
assert l.q.w.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: D = None
        self.u: B = None
        self.txt = txt

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

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

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

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

j.p = m
j.v = m
j.u = g
g.r = j
g.u = j
g.s = e
l.q = e
l.w = b
l.o = m
l.y = j
m.s = j
b.r = j
b.u = j
b.s = l
e.q = l
e.w = g
e.o = m
e.y = j
a.r = j
a.u = j
a.s = l
assert l.q.w.s.o.s.txt == "j"