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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: C = None
        self.p: F = None
        self.t: C = None
        self.o: H = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.v: A = None
        self.z: B = None
        self.o: E = None
        self.s: D = None
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.z: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

n.x = f
n.s = b
n.y = l
b.p = f
f.q = e
h.x = l
h.p = l
h.u = f
h.t = f
h.z = f
h.o = i
e.q = g
l.r = f
l.x = h
l.s = h
l.v = n
l.z = b
l.o = e
l.q = g
g.w = n
g.z = n
g.y = f
i.r = e
assert l.o.q.y.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: B = None
        self.y: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: C = None
        self.p: F = None
        self.t: C = None
        self.o: H = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.v: A = None
        self.z: B = None
        self.o: E = None
        self.s: D = None
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.z: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

n.x = f
n.s = b
n.y = l
b.p = f
f.q = e
h.x = l
h.p = l
h.u = f
h.t = f
h.z = f
h.o = i
e.q = g
l.r = f
l.x = h
l.s = h
l.v = n
l.z = b
l.o = e
l.q = g
g.w = n
g.z = n
g.y = f
i.r = e
assert l.o.q.y.q.q.txt == "g"