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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: G = None
        self.x: G = None
        self.o: F = None
        self.v: C = None
        self.u: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: B = None
        self.y: B = None
        self.u: G = None
        self.s: C = None
        self.txt = txt

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

h = A("h")
j = B("j")
a = C("a")
e = D("e")
i = E("i")
m = F("m")
n = G("n")

h.t = n
j.p = a
j.v = a
j.r = n
j.x = n
j.u = n
j.o = m
a.z = n
a.o = n
a.r = n
a.w = e
e.p = m
e.t = h
i.w = e
m.z = n
m.u = n
m.p = j
m.y = j
m.s = a
n.u = m
n.w = h
assert i.w.p.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: G = None
        self.x: G = None
        self.o: F = None
        self.v: C = None
        self.u: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: B = None
        self.y: B = None
        self.u: G = None
        self.s: C = None
        self.txt = txt

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

h = A("h")
j = B("j")
a = C("a")
e = D("e")
i = E("i")
m = F("m")
n = G("n")

h.t = n
j.p = a
j.v = a
j.r = n
j.x = n
j.u = n
j.o = m
a.z = n
a.o = n
a.r = n
a.w = e
e.p = m
e.t = h
i.w = e
m.z = n
m.u = n
m.p = j
m.y = j
m.s = a
n.u = m
n.w = h
assert i.w.p.s.r.txt == "n"