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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

m = A("m")
f = B("f")
e = C("e")
a = D("a")
i = E("i")
d = F("d")
h = F("h")
k = A("k")
b = A("b")

m.y = i
m.v = i
m.s = d
m.p = a
m.o = k
f.v = a
f.s = e
e.o = f
a.q = h
i.w = d
i.y = k
d.t = f
d.x = m
h.t = f
h.x = m
k.y = i
k.v = i
k.s = d
k.p = a
k.o = b
b.y = i
b.v = i
b.s = h
b.p = a
b.o = m
assert h.t.s.o.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: F = None
        self.p: D = None
        self.v: E = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

m = A("m")
f = B("f")
e = C("e")
a = D("a")
i = E("i")
d = F("d")
h = F("h")
k = A("k")
b = A("b")

m.y = i
m.v = i
m.s = d
m.p = a
m.o = k
f.v = a
f.s = e
e.o = f
a.q = h
i.w = d
i.y = k
d.t = f
d.x = m
h.t = f
h.x = m
k.y = i
k.v = i
k.s = d
k.p = a
k.o = b
b.y = i
b.v = i
b.s = h
b.p = a
b.o = m
assert h.t.s.o.v.q.txt == "h"