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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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