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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: C = None
        self.s: D = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
c = C("c")
k = D("k")
i = E("i")
d = F("d")
a = C("a")

g.y = i
g.x = c
f.q = i
f.w = a
f.s = k
f.t = d
c.q = k
k.s = g
i.v = c
i.o = k
i.y = g
d.r = f
d.x = i
d.w = i
d.s = i
d.t = g
d.o = k
a.q = k
assert d.s.o.s.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: C = None
        self.s: D = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
c = C("c")
k = D("k")
i = E("i")
d = F("d")
a = C("a")

g.y = i
g.x = c
f.q = i
f.w = a
f.s = k
f.t = d
c.q = k
k.s = g
i.v = c
i.o = k
i.y = g
d.r = f
d.x = i
d.w = i
d.s = i
d.t = g
d.o = k
a.q = k
assert d.s.o.s.y.v.txt == "c"