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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

h = A("h")
b = B("b")
g = C("g")
c = D("c")
i = E("i")
j = F("j")
a = C("a")
n = E("n")
l = C("l")
m = A("m")

h.o = m
h.y = n
h.w = b
b.z = m
g.o = c
c.t = g
c.x = j
i.p = m
j.s = h
a.o = c
n.p = h
l.o = c
m.o = h
m.y = n
m.w = b
assert g.o.t.o.x.s.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: E = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

h = A("h")
b = B("b")
g = C("g")
c = D("c")
i = E("i")
j = F("j")
a = C("a")
n = E("n")
l = C("l")
m = A("m")

h.o = m
h.y = n
h.w = b
b.z = m
g.o = c
c.t = g
c.x = j
i.p = m
j.s = h
a.o = c
n.p = h
l.o = c
m.o = h
m.y = n
m.w = b
assert g.o.t.o.x.s.w.z.txt == "m"