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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: A = None
        self.s: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: B = None
        self.r: D = None
        self.s: A = None
        self.txt = txt

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

l.p = k
e.w = g
e.s = g
e.o = l
a.p = i
a.s = g
a.o = g
a.w = g
d.v = i
d.p = l
k.s = g
g.o = l
g.s = l
g.w = e
g.r = d
i.s = g
assert l.p.s.o.p.s.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: A = None
        self.s: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: B = None
        self.r: D = None
        self.s: A = None
        self.txt = txt

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

l.p = k
e.w = g
e.s = g
e.o = l
a.p = i
a.s = g
a.o = g
a.w = g
d.v = i
d.p = l
k.s = g
g.o = l
g.s = l
g.w = e
g.r = d
i.s = g
assert l.p.s.o.p.s.o.p.txt == "k"