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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: A = None
        self.q: G = None
        self.v: D = None
        self.w: D = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: F = None
        self.o: F = None
        self.u: F = None
        self.v: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.r: G = None
        self.s: F = None
        self.z: F = None
        self.p: F = None
        self.w: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

a = A("a")
d = B("d")
m = C("m")
b = D("b")
k = E("k")
i = F("i")
f = G("f")

a.s = i
a.x = k
d.r = i
d.x = a
d.q = f
d.v = b
d.w = b
d.p = b
m.u = i
m.v = b
m.r = b
b.x = i
b.y = i
b.o = i
b.u = i
b.v = k
k.t = a
k.u = a
k.r = f
k.s = i
k.z = i
k.p = i
k.w = b
i.s = b
i.v = k
i.x = a
f.w = i
assert i.s.o.s.v.w.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: A = None
        self.q: G = None
        self.v: D = None
        self.w: D = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: F = None
        self.o: F = None
        self.u: F = None
        self.v: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.r: G = None
        self.s: F = None
        self.z: F = None
        self.p: F = None
        self.w: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

a = A("a")
d = B("d")
m = C("m")
b = D("b")
k = E("k")
i = F("i")
f = G("f")

a.s = i
a.x = k
d.r = i
d.x = a
d.q = f
d.v = b
d.w = b
d.p = b
m.u = i
m.v = b
m.r = b
b.x = i
b.y = i
b.o = i
b.u = i
b.v = k
k.t = a
k.u = a
k.r = f
k.s = i
k.z = i
k.p = i
k.w = b
i.s = b
i.v = k
i.x = a
f.w = i
assert i.s.o.s.v.w.v.r.txt == "f"