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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: H = None
        self.u: F = None
        self.t: F = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

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

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

f = A("f")
g = B("g")
k = C("k")
n = D("n")
d = E("d")
j = F("j")
e = G("e")
c = H("c")

f.u = d
g.v = j
g.r = k
g.o = k
k.q = f
k.t = f
n.v = f
n.s = g
n.y = g
n.u = d
n.p = d
n.x = j
n.w = k
d.r = c
d.u = j
d.t = j
d.q = f
j.r = c
e.s = d
e.y = f
e.t = g
c.r = e
c.v = g
assert g.r.q.u.q.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: H = None
        self.u: F = None
        self.t: F = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: H = None
        self.txt = txt

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

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

f = A("f")
g = B("g")
k = C("k")
n = D("n")
d = E("d")
j = F("j")
e = G("e")
c = H("c")

f.u = d
g.v = j
g.r = k
g.o = k
k.q = f
k.t = f
n.v = f
n.s = g
n.y = g
n.u = d
n.p = d
n.x = j
n.w = k
d.r = c
d.u = j
d.t = j
d.q = f
j.r = c
e.s = d
e.y = f
e.t = g
c.r = e
c.v = g
assert g.r.q.u.q.u.u.r.txt == "c"