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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: E = None
        self.o: D = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

k = A("k")
j = B("j")
d = C("d")
n = D("n")
b = E("b")
f = A("f")
l = D("l")

k.p = n
k.q = n
j.s = b
j.v = d
j.o = d
d.v = j
n.x = b
n.s = b
n.o = l
n.v = j
n.p = d
b.y = n
b.v = k
b.u = j
b.q = j
f.p = n
f.q = l
l.x = b
l.s = b
l.o = n
l.v = j
l.p = d
assert l.s.u.o.v.s.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: E = None
        self.o: D = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

k = A("k")
j = B("j")
d = C("d")
n = D("n")
b = E("b")
f = A("f")
l = D("l")

k.p = n
k.q = n
j.s = b
j.v = d
j.o = d
d.v = j
n.x = b
n.s = b
n.o = l
n.v = j
n.p = d
b.y = n
b.v = k
b.u = j
b.q = j
f.p = n
f.q = l
l.x = b
l.s = b
l.o = n
l.v = j
l.p = d
assert l.s.u.o.v.s.v.q.txt == "n"