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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

d.t = b
d.p = m
d.q = m
n.y = m
n.o = m
n.u = j
n.t = j
n.r = c
n.p = d
c.t = g
c.s = b
b.x = m
b.q = m
m.o = j
j.y = n
j.s = n
j.q = c
g.p = b
g.t = d
g.z = d
g.q = d
g.x = n
g.o = c
g.v = m
assert b.x.o.q.t.q.txt == "d"