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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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