class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: E = None
        self.p: C = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: C = None
        self.s: C = None
        self.o: C = None
        self.q: B = None
        self.txt = txt

k = A("k")
g = B("g")
i = C("i")
h = D("h")
l = E("l")

k.s = h
k.r = h
k.t = l
k.y = l
k.p = i
g.u = h
g.v = i
i.t = g
h.p = g
h.q = k
l.y = i
l.v = i
l.s = i
l.o = i
l.q = g
assert l.s.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: E = None
        self.p: C = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: C = None
        self.s: C = None
        self.o: C = None
        self.q: B = None
        self.txt = txt

k = A("k")
g = B("g")
i = C("i")
h = D("h")
l = E("l")

k.s = h
k.r = h
k.t = l
k.y = l
k.p = i
g.u = h
g.v = i
i.t = g
h.p = g
h.q = k
l.y = i
l.v = i
l.s = i
l.o = i
l.q = g
assert l.s.t.u.txt == "h"