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

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: H = None
        self.u: F = None
        self.x: E = None
        self.z: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: H = None
        self.v: F = None
        self.u: C = None
        self.x: E = None
        self.y: B = None
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: D = None
        self.q: A = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

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

k = A("k")
d = B("d")
j = C("j")
i = D("i")
f = E("f")
e = F("e")
b = G("b")
h = H("h")
c = A("c")

k.x = h
k.r = c
d.y = i
d.p = h
d.z = h
d.u = e
d.x = f
j.z = e
i.w = e
i.v = e
i.r = h
i.u = j
i.x = f
i.y = d
i.q = b
f.z = b
e.y = f
e.u = h
b.z = f
b.t = i
b.q = c
b.r = k
b.p = j
h.x = e
c.x = h
c.r = k
assert b.q.r.x.x.u.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: H = None
        self.u: F = None
        self.x: E = None
        self.z: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: H = None
        self.v: F = None
        self.u: C = None
        self.x: E = None
        self.y: B = None
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: D = None
        self.q: A = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

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

k = A("k")
d = B("d")
j = C("j")
i = D("i")
f = E("f")
e = F("e")
b = G("b")
h = H("h")
c = A("c")

k.x = h
k.r = c
d.y = i
d.p = h
d.z = h
d.u = e
d.x = f
j.z = e
i.w = e
i.v = e
i.r = h
i.u = j
i.x = f
i.y = d
i.q = b
f.z = b
e.y = f
e.u = h
b.z = f
b.t = i
b.q = c
b.r = k
b.p = j
h.x = e
c.x = h
c.r = k
assert b.q.r.x.x.u.x.y.txt == "f"