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

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

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

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

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

c = A("c")
i = B("i")
f = C("f")
l = D("l")
a = E("a")
g = B("g")

c.x = f
c.o = l
i.r = f
i.p = l
f.u = i
l.o = i
l.q = c
a.t = i
a.x = l
g.r = f
g.p = l
assert a.x.q.x.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

c = A("c")
i = B("i")
f = C("f")
l = D("l")
a = E("a")
g = B("g")

c.x = f
c.o = l
i.r = f
i.p = l
f.u = i
l.o = i
l.q = c
a.t = i
a.x = l
g.r = f
g.p = l
assert a.x.q.x.u.r.u.txt == "i"