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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

d = A("d")
b = B("b")
c = C("c")
g = D("g")
l = E("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

d = A("d")
b = B("b")
c = C("c")
g = D("g")
l = E("l")

d.u = c
d.o = b
d.r = b
b.y = c
b.p = g
c.o = d
c.w = d
g.v = d
g.p = c
g.o = c
l.x = b
assert g.o.o.r.y.txt == "c"