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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: B = None
        self.u: A = None
        self.v: E = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

i = A("i")
j = B("j")
l = C("l")
d = D("d")
m = E("m")
g = F("g")

i.w = l
j.s = d
j.y = i
l.x = i
d.t = g
d.u = l
d.q = m
d.p = i
m.p = d
m.t = i
m.y = j
g.x = l
g.w = j
g.s = j
g.p = j
g.u = i
g.v = m
assert i.w.x.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: B = None
        self.u: A = None
        self.v: E = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

i = A("i")
j = B("j")
l = C("l")
d = D("d")
m = E("m")
g = F("g")

i.w = l
j.s = d
j.y = i
l.x = i
d.t = g
d.u = l
d.q = m
d.p = i
m.p = d
m.t = i
m.y = j
g.x = l
g.w = j
g.s = j
g.p = j
g.u = i
g.v = m
assert i.w.x.w.x.txt == "i"