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

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: C = None
        self.s: B = None
        self.y: F = None
        self.v: C = None
        self.x: F = None
        self.txt = txt

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

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

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

k.y = g
f.y = g
f.r = e
g.s = i
g.p = i
g.v = k
g.u = l
l.z = e
l.y = e
l.x = e
l.o = g
l.v = g
l.s = f
i.y = k
i.x = f
i.p = g
e.t = k
assert g.v.y.v.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: C = None
        self.s: B = None
        self.y: F = None
        self.v: C = None
        self.x: F = None
        self.txt = txt

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

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

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

k.y = g
f.y = g
f.r = e
g.s = i
g.p = i
g.v = k
g.u = l
l.z = e
l.y = e
l.x = e
l.o = g
l.v = g
l.s = f
i.y = k
i.x = f
i.p = g
e.t = k
assert g.v.y.v.y.p.txt == "i"