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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: A = None
        self.v: C = None
        self.x: C = 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.y: B = None
        self.x: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: A = None
        self.v: C = None
        self.x: C = 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.y: B = None
        self.x: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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