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

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

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

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

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

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

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

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

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

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

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

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

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

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

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