class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: C = None
        self.q: G = None
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: E = None
        self.s: B = None
        self.q: F = None
        self.v: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: E = None
        self.s: B = None
        self.q: F = None
        self.v: E = None
        self.txt = txt

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

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