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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: E = None
        self.x: C = None
        self.q: A = None
        self.w: A = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
n = C("n")
f = D("f")
m = E("m")
l = D("l")
c = D("c")
h = A("h")
d = E("d")

j.r = b
b.v = j
b.q = j
b.w = j
b.s = d
b.x = n
n.r = b
n.v = b
n.p = l
n.q = m
f.p = b
f.u = b
f.z = d
f.v = m
m.v = n
m.r = d
l.p = b
l.u = b
l.z = d
l.v = d
c.p = b
c.u = b
c.z = d
c.v = m
h.r = b
d.v = n
d.r = m
assert d.r.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: E = None
        self.x: C = None
        self.q: A = None
        self.w: A = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
n = C("n")
f = D("f")
m = E("m")
l = D("l")
c = D("c")
h = A("h")
d = E("d")

j.r = b
b.v = j
b.q = j
b.w = j
b.s = d
b.x = n
n.r = b
n.v = b
n.p = l
n.q = m
f.p = b
f.u = b
f.z = d
f.v = m
m.v = n
m.r = d
l.p = b
l.u = b
l.z = d
l.v = d
c.p = b
c.u = b
c.z = d
c.v = m
h.r = b
d.v = n
d.r = m
assert d.r.v.p.txt == "l"