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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: E = None
        self.v: D = None
        self.p: E = None
        self.x: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: D = None
        self.v: D = None
        self.u: D = None
        self.y: B = None
        self.txt = txt

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

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

l.z = h
l.w = c
l.p = m
l.y = f
l.v = f
l.q = g
g.z = f
g.v = f
g.s = m
g.p = m
g.x = l
c.v = g
f.z = h
f.v = l
m.z = l
m.r = f
m.v = f
m.u = f
m.y = g
h.q = c
h.x = l
assert f.z.x.w.v.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: C = None
        self.p: E = None
        self.y: D = None
        self.v: D = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: E = None
        self.v: D = None
        self.p: E = None
        self.x: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: D = None
        self.v: D = None
        self.u: D = None
        self.y: B = None
        self.txt = txt

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

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

l.z = h
l.w = c
l.p = m
l.y = f
l.v = f
l.q = g
g.z = f
g.v = f
g.s = m
g.p = m
g.x = l
c.v = g
f.z = h
f.v = l
m.z = l
m.r = f
m.v = f
m.u = f
m.y = g
h.q = c
h.x = l
assert f.z.x.w.v.p.z.txt == "l"