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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: A = None
        self.y: E = None
        self.s: D = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

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

i.x = h
i.z = h
m.t = h
m.q = i
m.y = j
m.s = f
m.w = e
a.p = g
a.t = g
k.p = m
k.v = m
g.v = a
h.y = i
h.t = f
e.q = h
e.y = k
j.v = a
f.p = m
f.v = m
assert j.v.p.v.p.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: A = None
        self.y: E = None
        self.s: D = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

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

i.x = h
i.z = h
m.t = h
m.q = i
m.y = j
m.s = f
m.w = e
a.p = g
a.t = g
k.p = m
k.v = m
g.v = a
h.y = i
h.t = f
e.q = h
e.y = k
j.v = a
f.p = m
f.v = m
assert j.v.p.v.p.v.p.txt == "g"