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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: A = None
        self.r: D = None
        self.z: D = None
        self.q: B = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.r: F = None
        self.p: F = None
        self.o: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: A = None
        self.r: D = None
        self.z: D = None
        self.q: B = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: C = None
        self.r: F = None
        self.p: F = None
        self.o: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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