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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.txt = txt

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

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

e.p = n
n.y = f
n.v = k
j.o = n
f.o = e
f.u = n
k.r = b
k.x = f
k.z = n
k.v = e
b.o = n
assert b.o.y.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.txt = txt

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

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

e.p = n
n.y = f
n.v = k
j.o = n
f.o = e
f.u = n
k.r = b
k.x = f
k.z = n
k.v = e
b.o = n
assert b.o.y.o.p.txt == "n"