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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: C = None
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

e = A("e")
h = B("h")
k = C("k")
n = D("n")
l = E("l")
a = F("a")
c = G("c")

e.t = k
h.y = e
h.s = e
h.o = n
h.t = n
h.u = k
k.o = a
n.o = l
n.p = h
l.r = n
l.w = k
l.u = c
a.w = e
a.z = k
c.y = e
assert a.w.t.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: C = None
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

e = A("e")
h = B("h")
k = C("k")
n = D("n")
l = E("l")
a = F("a")
c = G("c")

e.t = k
h.y = e
h.s = e
h.o = n
h.t = n
h.u = k
k.o = a
n.o = l
n.p = h
l.r = n
l.w = k
l.u = c
a.w = e
a.z = k
c.y = e
assert a.w.t.o.w.txt == "e"