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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: F = None
        self.z: E = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.r: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: E = None
        self.z: A = None
        self.txt = txt

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

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

c.x = f
c.t = k
k.w = g
k.s = g
g.y = f
d.u = f
d.z = f
d.q = b
d.o = e
f.s = e
f.r = c
b.y = e
b.v = f
b.z = c
e.s = g
e.x = b
assert d.z.r.t.s.y.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: F = None
        self.z: E = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.r: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: E = None
        self.z: A = None
        self.txt = txt

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

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

c.x = f
c.t = k
k.w = g
k.s = g
g.y = f
d.u = f
d.z = f
d.q = b
d.o = e
f.s = e
f.r = c
b.y = e
b.v = f
b.z = c
e.s = g
e.x = b
assert d.z.r.t.s.y.s.s.txt == "g"