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

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

h = A("h")
a = B("a")
b = C("b")
g = D("g")
k = E("k")

h.u = g
h.p = g
h.t = g
h.x = a
a.y = k
a.s = h
a.q = g
b.t = h
b.p = k
g.s = h
k.p = b
k.q = b
k.x = a
k.y = a
k.t = h
assert a.y.q.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: D = None
        self.t: D = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

h = A("h")
a = B("a")
b = C("b")
g = D("g")
k = E("k")

h.u = g
h.p = g
h.t = g
h.x = a
a.y = k
a.s = h
a.q = g
b.t = h
b.p = k
g.s = h
k.p = b
k.q = b
k.x = a
k.y = a
k.t = h
assert a.y.q.t.u.txt == "g"