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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

b.s = i
b.p = f
f.u = j
f.t = j
f.x = b
i.x = j
i.p = j
i.s = f
i.o = f
i.z = g
g.t = i
m.o = j
j.x = f
j.q = b
assert i.p.q.s.z.txt == "g"