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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: H = None
        self.t: A = None
        self.r: C = None
        self.y: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: H = None
        self.t: E = None
        self.y: B = None
        self.s: B = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: E = None
        self.s: H = None
        self.u: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

g = A("g")
d = B("d")
b = C("b")
c = D("c")
i = E("i")
h = F("h")
m = G("m")
f = H("f")
n = C("n")

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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: H = None
        self.t: A = None
        self.r: C = None
        self.y: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: H = None
        self.t: E = None
        self.y: B = None
        self.s: B = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: E = None
        self.s: H = None
        self.u: H = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

g = A("g")
d = B("d")
b = C("b")
c = D("c")
i = E("i")
h = F("h")
m = G("m")
f = H("f")
n = C("n")

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