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

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

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

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

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

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

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

n.o = k
i.y = l
g.v = c
g.y = e
e.t = k
c.z = i
k.v = g
l.o = k
assert l.o.v.y.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

n.o = k
i.y = l
g.v = c
g.y = e
e.t = k
c.z = i
k.v = g
l.o = k
assert l.o.v.y.t.v.txt == "g"