class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: G = None
        self.p: F = None
        self.q: G = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: G = None
        self.q: F = None
        self.z: F = None
        self.p: A = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.z: C = None
        self.t: A = None
        self.u: A = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.v: C = None
        self.w: G = None
        self.txt = txt

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

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

i.q = d
h.p = e
h.t = n
j.t = n
j.q = n
j.p = c
j.o = h
d.o = i
d.p = i
d.x = n
d.q = c
d.z = c
d.u = c
e.q = h
e.r = j
e.z = j
e.p = j
e.t = i
e.u = i
c.y = j
c.z = j
c.v = j
c.w = n
n.x = h
n.v = d
assert e.r.p.w.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: G = None
        self.p: F = None
        self.q: G = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: G = None
        self.q: F = None
        self.z: F = None
        self.p: A = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.z: C = None
        self.t: A = None
        self.u: A = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.v: C = None
        self.w: G = None
        self.txt = txt

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

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

i.q = d
h.p = e
h.t = n
j.t = n
j.q = n
j.p = c
j.o = h
d.o = i
d.p = i
d.x = n
d.q = c
d.z = c
d.u = c
e.q = h
e.r = j
e.z = j
e.p = j
e.t = i
e.u = i
c.y = j
c.z = j
c.v = j
c.w = n
n.x = h
n.v = d
assert e.r.p.w.x.t.txt == "n"