class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: H = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

f.z = j
f.y = m
c.o = l
g.r = c
d.x = m
d.u = l
l.o = d
l.y = j
j.q = m
j.u = l
j.z = c
n.r = l
n.z = j
m.u = l
assert m.u.o.x.u.y.u.o.txt == "d"