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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: D = None
        self.s: A = None
        self.y: D = None
        self.r: A = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.q: D = None
        self.u: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

h = A("h")
a = B("a")
n = C("n")
g = D("g")
l = E("l")
m = F("m")
i = G("i")
f = E("f")

h.r = f
h.s = i
a.z = m
a.x = g
a.y = g
a.t = g
a.q = g
a.s = h
a.r = h
n.w = h
n.v = i
n.q = g
n.u = g
g.u = f
g.q = l
l.u = m
l.y = m
l.t = n
l.s = f
l.o = f
l.q = g
m.t = a
m.s = f
i.r = g
f.u = m
f.y = m
f.t = n
f.s = l
f.o = l
f.q = g
assert h.r.s.y.t.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: D = None
        self.s: A = None
        self.y: D = None
        self.r: A = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.q: D = None
        self.u: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

h = A("h")
a = B("a")
n = C("n")
g = D("g")
l = E("l")
m = F("m")
i = G("i")
f = E("f")

h.r = f
h.s = i
a.z = m
a.x = g
a.y = g
a.t = g
a.q = g
a.s = h
a.r = h
n.w = h
n.v = i
n.q = g
n.u = g
g.u = f
g.q = l
l.u = m
l.y = m
l.t = n
l.s = f
l.o = f
l.q = g
m.t = a
m.s = f
i.r = g
f.u = m
f.y = m
f.t = n
f.s = l
f.o = l
f.q = g
assert h.r.s.y.t.s.r.txt == "f"