class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
b = C("b")
m = D("m")
l = E("l")

g.p = b
g.t = l
g.x = l
f.y = m
f.u = m
f.o = b
b.y = f
m.r = b
m.v = g
m.t = f
l.u = f
l.w = g
assert g.p.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
b = C("b")
m = D("m")
l = E("l")

g.p = b
g.t = l
g.x = l
f.y = m
f.u = m
f.o = b
b.y = f
m.r = b
m.v = g
m.t = f
l.u = f
l.w = g
assert g.p.y.o.y.txt == "f"