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

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

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

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

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

f = A("f")
l = B("l")
b = C("b")
n = D("n")
c = E("c")
i = C("i")

f.p = l
f.u = l
f.r = b
f.q = c
f.y = i
l.p = f
b.u = c
n.u = i
c.v = b
c.x = n
i.u = c
assert b.u.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: C = None
        self.u: B = None
        self.q: E = None
        self.y: C = None
        self.txt = txt

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

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

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

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

f = A("f")
l = B("l")
b = C("b")
n = D("n")
c = E("c")
i = C("i")

f.p = l
f.u = l
f.r = b
f.q = c
f.y = i
l.p = f
b.u = c
n.u = i
c.v = b
c.x = n
i.u = c
assert b.u.v.u.v.txt == "b"