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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.r: B = None
        self.o: H = None
        self.x: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: C = None
        self.y: E = None
        self.txt = txt

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

g = A("g")
a = B("a")
l = C("l")
m = D("m")
h = E("h")
b = F("b")
k = G("k")
i = H("i")

g.x = m
a.p = h
a.r = g
l.u = h
l.x = h
l.y = g
l.r = a
l.o = i
m.y = l
m.s = l
m.o = h
h.p = g
h.r = i
b.s = h
b.w = m
b.o = m
k.r = a
k.p = l
k.y = h
i.s = h
i.u = m
assert i.u.s.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.r: B = None
        self.o: H = None
        self.x: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: C = None
        self.y: E = None
        self.txt = txt

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

g = A("g")
a = B("a")
l = C("l")
m = D("m")
h = E("h")
b = F("b")
k = G("k")
i = H("i")

g.x = m
a.p = h
a.r = g
l.u = h
l.x = h
l.y = g
l.r = a
l.o = i
m.y = l
m.s = l
m.o = h
h.p = g
h.r = i
b.s = h
b.w = m
b.o = m
k.r = a
k.p = l
k.y = h
i.s = h
i.u = m
assert i.u.s.x.r.txt == "i"