class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.x: E = None
        self.s: B = None
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.y: D = None
        self.s: B = None
        self.txt = txt

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

g.r = d
g.s = d
g.p = l
g.q = l
g.x = a
d.y = a
d.t = l
d.r = l
f.o = a
f.v = l
l.t = d
l.o = d
l.s = g
l.v = g
l.u = f
a.x = g
a.u = d
a.s = d
a.y = l
assert a.y.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.x: E = None
        self.s: B = None
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: B = None
        self.y: D = None
        self.s: B = None
        self.txt = txt

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

g.r = d
g.s = d
g.p = l
g.q = l
g.x = a
d.y = a
d.t = l
d.r = l
f.o = a
f.v = l
l.t = d
l.o = d
l.s = g
l.v = g
l.u = f
a.x = g
a.u = d
a.s = d
a.y = l
assert a.y.t.y.txt == "a"