class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: G = None
        self.q: G = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.r: C = None
        self.t: E = None
        self.s: E = None
        self.p: B = None
        self.txt = txt

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

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

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

g = A("g")
i = B("i")
j = C("j")
b = D("b")
k = E("k")
c = F("c")
a = G("a")

g.r = k
g.t = a
g.q = a
g.s = j
i.w = c
i.q = c
j.r = i
j.v = g
b.x = j
b.r = j
b.q = c
b.t = k
b.s = k
b.p = i
k.w = c
k.p = j
c.y = g
c.p = g
c.q = g
c.x = g
c.t = j
c.u = i
a.p = j
a.v = g
a.t = b
a.u = c
assert c.u.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: G = None
        self.q: G = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.r: C = None
        self.t: E = None
        self.s: E = None
        self.p: B = None
        self.txt = txt

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

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

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

g = A("g")
i = B("i")
j = C("j")
b = D("b")
k = E("k")
c = F("c")
a = G("a")

g.r = k
g.t = a
g.q = a
g.s = j
i.w = c
i.q = c
j.r = i
j.v = g
b.x = j
b.r = j
b.q = c
b.t = k
b.s = k
b.p = i
k.w = c
k.p = j
c.y = g
c.p = g
c.q = g
c.x = g
c.t = j
c.u = i
a.p = j
a.v = g
a.t = b
a.u = c
assert c.u.w.q.txt == "g"