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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: D = None
        self.txt = txt

n = A("n")
h = B("h")
c = C("c")
b = D("b")
e = E("e")
d = F("d")
l = G("l")
g = G("g")
f = B("f")

n.v = b
n.z = b
n.t = h
h.q = c
c.z = d
c.v = e
b.s = d
b.t = c
b.x = n
e.p = g
e.o = h
d.w = n
d.q = g
l.v = f
l.s = b
g.v = h
g.s = b
f.q = c
assert e.p.s.s.q.s.x.z.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: B = None
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: D = None
        self.txt = txt

n = A("n")
h = B("h")
c = C("c")
b = D("b")
e = E("e")
d = F("d")
l = G("l")
g = G("g")
f = B("f")

n.v = b
n.z = b
n.t = h
h.q = c
c.z = d
c.v = e
b.s = d
b.t = c
b.x = n
e.p = g
e.o = h
d.w = n
d.q = g
l.v = f
l.s = b
g.v = h
g.s = b
f.q = c
assert e.p.s.s.q.s.x.z.x.t.txt == "h"