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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

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

h.t = d
h.w = j
k.z = h
k.v = f
d.y = k
a.y = k
f.x = j
j.x = a
j.s = a
j.o = f
j.u = k
j.y = k
j.p = h
n.z = a
assert h.t.y.z.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

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

h.t = d
h.w = j
k.z = h
k.v = f
d.y = k
a.y = k
f.x = j
j.x = a
j.s = a
j.o = f
j.u = k
j.y = k
j.p = h
n.z = a
assert h.t.y.z.w.x.y.txt == "k"