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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: B = None
        self.u: E = None
        self.q: A = None
        self.z: B = None
        self.w: B = None
        self.txt = txt

h = A("h")
g = B("g")
f = C("f")
n = D("n")
k = E("k")
l = F("l")
b = D("b")
c = F("c")
i = E("i")
e = B("e")

h.o = b
g.o = l
f.y = k
n.p = b
n.o = b
n.r = c
n.w = e
k.p = f
k.r = f
l.v = g
l.w = g
l.o = e
l.z = e
l.u = k
l.q = h
b.p = n
b.o = n
b.r = l
b.w = g
c.v = g
c.z = g
c.o = e
c.w = e
c.u = k
c.q = h
i.p = f
i.r = f
e.o = l
assert h.o.r.z.o.q.o.r.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: B = None
        self.u: E = None
        self.q: A = None
        self.z: B = None
        self.w: B = None
        self.txt = txt

h = A("h")
g = B("g")
f = C("f")
n = D("n")
k = E("k")
l = F("l")
b = D("b")
c = F("c")
i = E("i")
e = B("e")

h.o = b
g.o = l
f.y = k
n.p = b
n.o = b
n.r = c
n.w = e
k.p = f
k.r = f
l.v = g
l.w = g
l.o = e
l.z = e
l.u = k
l.q = h
b.p = n
b.o = n
b.r = l
b.w = g
c.v = g
c.z = g
c.o = e
c.w = e
c.u = k
c.q = h
i.p = f
i.r = f
e.o = l
assert h.o.r.z.o.q.o.r.u.p.txt == "f"