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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: G = None
        self.y: B = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: G = None
        self.v: E = None
        self.p: B = None
        self.r: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: G = None
        self.y: B = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: G = None
        self.v: E = None
        self.p: B = None
        self.r: B = None
        self.txt = txt

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

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

h.r = f
h.v = n
d.s = j
d.w = h
i.v = e
i.p = h
j.v = e
e.w = h
e.x = n
e.y = d
e.r = i
e.o = i
f.s = e
f.v = e
f.q = n
f.p = d
f.r = d
n.o = h
n.y = h
n.r = h
n.v = e
n.q = j
n.u = f
assert e.r.p.r.p.w.r.txt == "f"