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

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

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

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

i = A("i")
e = B("e")
b = C("b")
m = D("m")
l = D("l")
n = C("n")
k = B("k")
d = D("d")

i.p = k
i.u = b
i.q = n
e.q = b
e.u = k
e.p = k
e.y = l
b.v = i
b.o = l
b.x = n
m.x = b
l.x = b
n.v = i
n.o = m
n.x = b
k.q = b
k.u = e
k.p = e
k.y = m
d.x = n
assert n.v.q.o.x.o.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: C = None
        self.q: C = None
        self.txt = txt

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

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

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

i = A("i")
e = B("e")
b = C("b")
m = D("m")
l = D("l")
n = C("n")
k = B("k")
d = D("d")

i.p = k
i.u = b
i.q = n
e.q = b
e.u = k
e.p = k
e.y = l
b.v = i
b.o = l
b.x = n
m.x = b
l.x = b
n.v = i
n.o = m
n.x = b
k.q = b
k.u = e
k.p = e
k.y = m
d.x = n
assert n.v.q.o.x.o.x.v.txt == "i"