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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.q: D = None
        self.p: D = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: D = None
        self.q: D = None
        self.p: D = None
        self.t: E = None
        self.txt = txt

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

n.p = e
c.q = n
c.u = n
c.w = e
e.y = a
i.v = l
i.p = n
i.q = a
i.s = k
i.y = e
i.t = e
l.r = n
l.w = k
l.v = e
a.o = e
k.r = i
k.o = i
k.q = i
k.p = i
k.t = l
assert k.q.y.y.o.y.txt == "a"