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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: F = None
        self.y: F = None
        self.t: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

d.v = k
d.r = j
d.w = b
d.s = b
d.t = i
d.x = i
i.z = d
i.v = h
i.x = b
i.y = j
f.r = k
f.x = j
f.y = j
f.t = i
b.y = j
b.s = j
k.s = h
j.r = i
h.t = i
assert h.t.z.r.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: F = None
        self.w: D = None
        self.s: D = None
        self.t: B = None
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: F = None
        self.y: F = None
        self.t: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

d.v = k
d.r = j
d.w = b
d.s = b
d.t = i
d.x = i
i.z = d
i.v = h
i.x = b
i.y = j
f.r = k
f.x = j
f.y = j
f.t = i
b.y = j
b.s = j
k.s = h
j.r = i
h.t = i
assert h.t.z.r.r.z.txt == "d"