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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

i = A("i")
l = B("l")
g = C("g")
k = D("k")
d = E("d")
f = F("f")
h = A("h")
c = F("c")
m = B("m")

i.w = m
i.x = m
i.v = l
i.p = c
l.y = f
l.v = i
l.w = m
l.s = c
g.p = m
k.v = i
k.z = g
d.x = k
f.w = g
h.w = m
h.x = m
h.v = l
h.p = c
c.w = g
m.y = f
m.s = f
m.v = h
m.w = l
assert h.p.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: B = None
        self.x: B = None
        self.p: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

i = A("i")
l = B("l")
g = C("g")
k = D("k")
d = E("d")
f = F("f")
h = A("h")
c = F("c")
m = B("m")

i.w = m
i.x = m
i.v = l
i.p = c
l.y = f
l.v = i
l.w = m
l.s = c
g.p = m
k.v = i
k.z = g
d.x = k
f.w = g
h.w = m
h.x = m
h.v = l
h.p = c
c.w = g
m.y = f
m.s = f
m.v = h
m.w = l
assert h.p.w.p.txt == "m"