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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: D = None
        self.v: B = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: A = None
        self.p: B = None
        self.txt = txt

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

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

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

f.v = b
i.q = g
i.x = b
i.v = h
i.u = a
e.p = f
b.z = f
b.r = f
b.p = i
m.p = f
m.v = c
g.t = i
c.p = f
c.v = m
a.p = f
h.q = g
h.x = b
h.v = i
h.u = e
n.z = f
n.r = f
n.p = i
assert e.p.v.z.v.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: D = None
        self.v: B = None
        self.u: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: A = None
        self.p: B = None
        self.txt = txt

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

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

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

f.v = b
i.q = g
i.x = b
i.v = h
i.u = a
e.p = f
b.z = f
b.r = f
b.p = i
m.p = f
m.v = c
g.t = i
c.p = f
c.v = m
a.p = f
h.q = g
h.x = b
h.v = i
h.u = e
n.z = f
n.r = f
n.p = i
assert e.p.v.z.v.p.v.txt == "h"