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

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

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

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

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

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

h = A("h")
e = B("e")
c = C("c")
b = D("b")
a = E("a")
j = F("j")

h.s = j
e.w = h
c.q = h
c.y = h
b.q = j
b.s = j
a.o = b
a.z = h
a.v = j
a.r = j
a.w = j
a.x = e
j.s = a
assert e.w.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

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

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

h = A("h")
e = B("e")
c = C("c")
b = D("b")
a = E("a")
j = F("j")

h.s = j
e.w = h
c.q = h
c.y = h
b.q = j
b.s = j
a.o = b
a.z = h
a.v = j
a.r = j
a.w = j
a.x = e
j.s = a
assert e.w.s.s.txt == "a"