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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: H = None
        self.q: B = None
        self.r: H = None
        self.z: F = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

k = A("k")
l = B("l")
m = C("m")
j = D("j")
n = E("n")
h = F("h")
c = G("c")
i = H("i")
f = E("f")

k.x = j
l.y = c
l.w = c
l.p = c
l.v = j
m.s = h
m.z = h
m.t = i
m.r = i
m.q = l
m.w = c
j.v = k
j.y = c
j.u = h
n.t = j
h.q = l
h.p = j
h.z = i
c.q = h
i.t = m
f.t = j
assert f.t.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: H = None
        self.q: B = None
        self.r: H = None
        self.z: F = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

k = A("k")
l = B("l")
m = C("m")
j = D("j")
n = E("n")
h = F("h")
c = G("c")
i = H("i")
f = E("f")

k.x = j
l.y = c
l.w = c
l.p = c
l.v = j
m.s = h
m.z = h
m.t = i
m.r = i
m.q = l
m.w = c
j.v = k
j.y = c
j.u = h
n.t = j
h.q = l
h.p = j
h.z = i
c.q = h
i.t = m
f.t = j
assert f.t.v.x.txt == "j"