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

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

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

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

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

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

a = A("a")
g = B("g")
i = C("i")
l = D("l")
c = E("c")
h = F("h")

a.x = c
a.z = h
g.w = a
g.s = i
g.t = l
i.t = c
i.p = g
l.x = a
l.p = h
c.w = a
h.x = g
assert i.t.w.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

a = A("a")
g = B("g")
i = C("i")
l = D("l")
c = E("c")
h = F("h")

a.x = c
a.z = h
g.w = a
g.s = i
g.t = l
i.t = c
i.p = g
l.x = a
l.p = h
c.w = a
h.x = g
assert i.t.w.x.w.txt == "a"