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

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

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

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

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

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

m = A("m")
g = B("g")
d = C("d")
h = D("h")
e = E("e")
b = F("b")
k = E("k")
a = F("a")

m.r = h
m.t = b
g.p = h
g.q = h
d.o = b
d.s = b
d.p = e
d.y = e
h.v = g
h.w = e
h.y = d
e.p = h
e.w = g
e.o = m
e.v = d
b.y = g
k.p = h
k.w = g
k.o = m
k.v = d
a.y = g
assert k.w.q.y.s.y.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: F = None
        self.txt = txt

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

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

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

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

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

m = A("m")
g = B("g")
d = C("d")
h = D("h")
e = E("e")
b = F("b")
k = E("k")
a = F("a")

m.r = h
m.t = b
g.p = h
g.q = h
d.o = b
d.s = b
d.p = e
d.y = e
h.v = g
h.w = e
h.y = d
e.p = h
e.w = g
e.o = m
e.v = d
b.y = g
k.p = h
k.w = g
k.o = m
k.v = d
a.y = g
assert k.w.q.y.s.y.p.w.txt == "e"