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

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.w: A = None
        self.p: C = None
        self.u: B = None
        self.txt = txt

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

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

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

a.t = f
h.r = e
h.q = b
h.x = b
h.y = k
f.o = b
f.p = b
f.t = a
f.w = a
f.u = h
e.r = k
e.z = a
e.t = g
d.p = a
d.z = k
k.p = a
k.z = d
g.r = k
g.z = a
g.t = e
b.o = f
b.p = f
b.t = a
b.w = a
b.u = h
assert g.z.t.u.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.w: A = None
        self.p: C = None
        self.u: B = None
        self.txt = txt

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

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

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

a.t = f
h.r = e
h.q = b
h.x = b
h.y = k
f.o = b
f.p = b
f.t = a
f.w = a
f.u = h
e.r = k
e.z = a
e.t = g
d.p = a
d.z = k
k.p = a
k.z = d
g.r = k
g.z = a
g.t = e
b.o = f
b.p = f
b.t = a
b.w = a
b.u = h
assert g.z.t.u.r.r.txt == "k"