class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.o: E = None
        self.x: F = None
        self.u: B = None
        self.z: E = None
        self.t: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

f.z = m
f.t = j
f.w = j
m.t = f
g.r = b
g.o = h
g.z = h
g.x = i
g.u = m
g.t = j
g.s = f
j.t = g
j.y = f
h.z = i
i.p = b
b.t = h
assert h.z.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.o: E = None
        self.x: F = None
        self.u: B = None
        self.z: E = None
        self.t: D = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

f.z = m
f.t = j
f.w = j
m.t = f
g.r = b
g.o = h
g.z = h
g.x = i
g.u = m
g.t = j
g.s = f
j.t = g
j.y = f
h.z = i
i.p = b
b.t = h
assert h.z.p.t.txt == "h"