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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: E = None
        self.r: G = None
        self.x: G = None
        self.v: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: D = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

h = A("h")
b = B("b")
c = C("c")
e = D("e")
n = E("n")
g = F("g")
j = G("j")

h.z = b
h.v = b
h.p = j
h.t = n
h.w = e
b.q = n
c.z = g
c.t = n
c.r = j
c.x = j
c.v = h
e.r = c
e.o = n
n.z = g
n.t = b
g.p = n
g.v = b
j.v = c
j.s = e
j.q = b
j.y = b
assert g.p.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.p: G = None
        self.t: E = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: E = None
        self.r: G = None
        self.x: G = None
        self.v: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: D = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

h = A("h")
b = B("b")
c = C("c")
e = D("e")
n = E("n")
g = F("g")
j = G("j")

h.z = b
h.v = b
h.p = j
h.t = n
h.w = e
b.q = n
c.z = g
c.t = n
c.r = j
c.x = j
c.v = h
e.r = c
e.o = n
n.z = g
n.t = b
g.p = n
g.v = b
j.v = c
j.s = e
j.q = b
j.y = b
assert g.p.t.q.txt == "n"