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

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

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

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

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

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

h = A("h")
f = B("f")
l = C("l")
d = D("d")
m = E("m")
a = F("a")
b = F("b")
j = F("j")
c = C("c")
e = C("e")

h.o = e
h.z = m
f.w = h
f.r = d
l.u = m
l.v = e
d.s = h
d.p = f
m.r = h
a.p = h
b.p = h
j.p = h
c.u = m
c.v = l
e.u = m
e.v = c
assert b.p.z.r.z.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

h = A("h")
f = B("f")
l = C("l")
d = D("d")
m = E("m")
a = F("a")
b = F("b")
j = F("j")
c = C("c")
e = C("e")

h.o = e
h.z = m
f.w = h
f.r = d
l.u = m
l.v = e
d.s = h
d.p = f
m.r = h
a.p = h
b.p = h
j.p = h
c.u = m
c.v = l
e.u = m
e.v = c
assert b.p.z.r.z.r.o.txt == "e"