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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: A = None
        self.z: D = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

m.p = f
m.s = h
c.r = h
c.q = j
c.p = j
c.t = j
c.v = n
j.s = h
j.z = h
j.r = m
j.x = i
l.w = j
f.z = i
i.z = f
e.r = l
e.q = j
e.p = j
e.t = j
e.v = n
n.r = l
n.q = j
n.p = j
n.t = j
n.v = e
h.w = j
assert n.v.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: A = None
        self.z: D = None
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

m.p = f
m.s = h
c.r = h
c.q = j
c.p = j
c.t = j
c.v = n
j.s = h
j.z = h
j.r = m
j.x = i
l.w = j
f.z = i
i.z = f
e.r = l
e.q = j
e.p = j
e.t = j
e.v = n
n.r = l
n.q = j
n.p = j
n.t = j
n.v = e
h.w = j
assert n.v.r.w.txt == "j"