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

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

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

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

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

l.p = e
l.w = b
e.p = m
e.v = j
m.o = a
n.x = m
n.v = m
n.q = a
n.t = a
b.p = j
b.w = l
j.p = m
j.v = e
a.x = m
a.v = m
a.q = n
a.t = n
assert j.v.v.p.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: A = None
        self.txt = txt

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

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

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

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

l.p = e
l.w = b
e.p = m
e.v = j
m.o = a
n.x = m
n.v = m
n.q = a
n.t = a
b.p = j
b.w = l
j.p = m
j.v = e
a.x = m
a.v = m
a.q = n
a.t = n
assert j.v.v.p.o.x.txt == "m"