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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: F = None
        self.z: A = None
        self.o: C = None
        self.t: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: A = None
        self.p: F = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: F = None
        self.z: A = None
        self.o: C = None
        self.t: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.q: A = None
        self.p: F = None
        self.txt = txt

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

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

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

j.s = g
j.x = i
a.y = n
a.t = n
a.w = b
a.z = j
a.o = f
f.y = c
n.y = g
n.q = j
n.p = i
g.o = j
i.s = j
c.y = f
e.o = j
b.s = j
assert n.q.x.s.x.s.s.o.txt == "j"