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

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

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

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

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

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

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

j.r = h
j.o = b
j.v = b
j.t = c
b.p = e
n.r = b
n.t = b
l.y = d
l.t = d
l.u = e
l.w = c
e.w = b
e.t = j
h.p = d
m.w = b
m.t = j
c.r = h
c.o = b
c.v = b
c.t = j
d.y = l
d.t = l
d.u = m
d.w = c
assert h.p.w.r.p.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.o: B = None
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

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

j.r = h
j.o = b
j.v = b
j.t = c
b.p = e
n.r = b
n.t = b
l.y = d
l.t = d
l.u = e
l.w = c
e.w = b
e.t = j
h.p = d
m.w = b
m.t = j
c.r = h
c.o = b
c.v = b
c.t = j
d.y = l
d.t = l
d.u = m
d.w = c
assert h.p.w.r.p.w.r.txt == "h"