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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: C = None
        self.s: A = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: F = None
        self.r: A = None
        self.s: B = None
        self.v: B = None
        self.txt = txt

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

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

l.p = b
a.p = n
a.t = k
a.r = k
a.s = l
k.p = n
k.y = n
k.s = n
k.r = i
b.r = n
g.p = n
g.o = n
g.r = l
g.s = a
g.v = a
n.t = a
n.o = k
i.p = n
i.t = k
i.r = k
i.s = l
e.r = n
assert k.r.r.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: C = None
        self.s: A = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: F = None
        self.r: A = None
        self.s: B = None
        self.v: B = None
        self.txt = txt

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

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

l.p = b
a.p = n
a.t = k
a.r = k
a.s = l
k.p = n
k.y = n
k.s = n
k.r = i
b.r = n
g.p = n
g.o = n
g.r = l
g.s = a
g.v = a
n.t = a
n.o = k
i.p = n
i.t = k
i.r = k
i.s = l
e.r = n
assert k.r.r.s.o.txt == "k"