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

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

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

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

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

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

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

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

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

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

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

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

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

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

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