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

class B:
    def __init__(self, txt: str):
        self.y: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: H = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
l = D("l")
k = E("k")
c = F("c")
j = G("j")
m = H("m")
i = A("i")
a = B("a")

g.x = c
g.r = i
g.o = m
f.y = m
d.s = k
l.u = j
l.p = m
k.x = l
k.u = l
k.y = c
c.r = f
j.u = c
m.q = k
m.x = l
i.x = c
i.r = g
i.o = m
a.y = m
assert a.y.q.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: A = None
        self.o: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: H = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
l = D("l")
k = E("k")
c = F("c")
j = G("j")
m = H("m")
i = A("i")
a = B("a")

g.x = c
g.r = i
g.o = m
f.y = m
d.s = k
l.u = j
l.p = m
k.x = l
k.u = l
k.y = c
c.r = f
j.u = c
m.q = k
m.x = l
i.x = c
i.r = g
i.o = m
a.y = m
assert a.y.q.u.u.u.txt == "c"