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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: E = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: B = None
        self.t: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

l.o = h
l.r = b
f.o = i
f.q = h
f.z = b
d.u = j
d.x = f
d.t = h
i.q = c
i.y = c
i.p = c
i.x = j
h.s = l
c.w = l
b.r = i
b.x = h
j.x = c
assert d.x.o.x.x.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: E = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: B = None
        self.t: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

l.o = h
l.r = b
f.o = i
f.q = h
f.z = b
d.u = j
d.x = f
d.t = h
i.q = c
i.y = c
i.p = c
i.x = j
h.s = l
c.w = l
b.r = i
b.x = h
j.x = c
assert d.x.o.x.x.w.r.txt == "b"