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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

e = A("e")
c = B("c")
g = C("g")
k = D("k")
b = E("b")

e.q = b
e.p = b
e.y = b
e.r = g
c.s = g
c.u = e
g.t = k
k.t = c
k.p = c
k.o = e
k.x = b
b.p = k
assert g.t.p.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: E = None
        self.r: C = None
        self.y: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

e = A("e")
c = B("c")
g = C("g")
k = D("k")
b = E("b")

e.q = b
e.p = b
e.y = b
e.r = g
c.s = g
c.u = e
g.t = k
k.t = c
k.p = c
k.o = e
k.x = b
b.p = k
assert g.t.p.u.q.txt == "b"