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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: F = None
        self.r: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: F = None
        self.r: C = None
        self.w: C = None
        self.txt = txt

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

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