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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: F = 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.w: E = None
        self.txt = txt

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

i = A("i")
j = B("j")
n = C("n")
f = D("f")
d = E("d")
a = F("a")
e = G("e")
m = A("m")

i.y = e
i.p = d
i.q = a
i.r = a
j.t = d
n.r = a
n.s = m
n.q = i
n.z = j
n.u = d
f.x = a
f.o = a
d.r = n
a.w = d
e.q = d
e.p = m
m.y = e
m.p = d
m.q = a
m.r = a
assert i.r.w.r.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.p: E = None
        self.q: F = None
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: F = 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.w: E = None
        self.txt = txt

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

i = A("i")
j = B("j")
n = C("n")
f = D("f")
d = E("d")
a = F("a")
e = G("e")
m = A("m")

i.y = e
i.p = d
i.q = a
i.r = a
j.t = d
n.r = a
n.s = m
n.q = i
n.z = j
n.u = d
f.x = a
f.o = a
d.r = n
a.w = d
e.q = d
e.p = m
m.y = e
m.p = d
m.q = a
m.r = a
assert i.r.w.r.q.y.txt == "e"