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

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: B = None
        self.t: G = None
        self.r: G = None
        self.s: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: B = None
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: E = None
        self.o: D = None
        self.p: E = None
        self.s: B = None
        self.txt = txt

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

b.y = c
k.v = b
k.x = c
k.p = j
k.r = j
k.q = h
k.u = n
h.w = c
h.t = c
h.r = c
h.o = k
h.s = n
j.q = b
d.r = h
n.s = k
n.v = k
n.t = c
c.u = b
c.q = d
c.p = d
c.o = j
c.s = k
assert b.y.o.q.y.o.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: B = None
        self.t: G = None
        self.r: G = None
        self.s: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: B = None
        self.t: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: E = None
        self.o: D = None
        self.p: E = None
        self.s: B = None
        self.txt = txt

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

b.y = c
k.v = b
k.x = c
k.p = j
k.r = j
k.q = h
k.u = n
h.w = c
h.t = c
h.r = c
h.o = k
h.s = n
j.q = b
d.r = h
n.s = k
n.v = k
n.t = c
c.u = b
c.q = d
c.p = d
c.o = j
c.s = k
assert b.y.o.q.y.o.q.y.txt == "c"