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

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: E = None
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

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

g.o = e
g.r = e
g.t = c
k.s = g
k.v = g
k.y = n
m.r = g
m.p = n
m.w = c
l.s = e
l.w = c
l.t = g
l.o = f
c.r = m
c.u = m
c.p = l
c.z = e
e.p = g
f.r = g
f.p = k
f.w = c
n.s = g
n.v = g
n.y = k
assert m.p.s.t.r.r.t.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: F = None
        self.t: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: E = None
        self.t: A = None
        self.o: C = None
        self.txt = txt

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

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

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

g.o = e
g.r = e
g.t = c
k.s = g
k.v = g
k.y = n
m.r = g
m.p = n
m.w = c
l.s = e
l.w = c
l.t = g
l.o = f
c.r = m
c.u = m
c.p = l
c.z = e
e.p = g
f.r = g
f.p = k
f.w = c
n.s = g
n.v = g
n.y = k
assert m.p.s.t.r.r.t.p.w.txt == "c"