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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

i = A("i")
g = B("g")
e = C("e")
m = D("m")
b = E("b")
f = F("f")

i.s = g
g.v = b
e.p = i
e.q = g
e.o = m
m.x = e
m.w = e
m.s = f
m.z = g
m.q = g
b.x = f
b.t = f
b.s = m
b.q = i
f.s = g
f.q = g
f.z = i
assert f.q.v.x.s.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: A = None
        self.q: B = None
        self.txt = txt

i = A("i")
g = B("g")
e = C("e")
m = D("m")
b = E("b")
f = F("f")

i.s = g
g.v = b
e.p = i
e.q = g
e.o = m
m.x = e
m.w = e
m.s = f
m.z = g
m.q = g
b.x = f
b.t = f
b.s = m
b.q = i
f.s = g
f.q = g
f.z = i
assert f.q.v.x.s.v.x.txt == "f"