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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.s: B = None
        self.y: F = None
        self.p: A = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
g = B("g")
l = C("l")
n = D("n")
h = E("h")
k = F("k")
f = A("f")
i = A("i")
m = B("m")

a.r = l
a.p = l
g.w = n
g.q = n
g.o = m
l.p = g
l.t = h
l.q = n
n.o = h
n.s = g
n.y = k
n.p = i
n.q = m
h.r = k
h.p = l
k.p = n
k.r = l
k.z = l
k.v = h
k.w = g
f.r = l
f.p = l
i.r = l
i.p = l
m.w = n
m.q = n
m.o = g
assert g.o.o.w.y.w.q.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.s: B = None
        self.y: F = None
        self.p: A = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
g = B("g")
l = C("l")
n = D("n")
h = E("h")
k = F("k")
f = A("f")
i = A("i")
m = B("m")

a.r = l
a.p = l
g.w = n
g.q = n
g.o = m
l.p = g
l.t = h
l.q = n
n.o = h
n.s = g
n.y = k
n.p = i
n.q = m
h.r = k
h.p = l
k.p = n
k.r = l
k.z = l
k.v = h
k.w = g
f.r = l
f.p = l
i.r = l
i.p = l
m.w = n
m.q = n
m.o = g
assert g.o.o.w.y.w.q.y.r.txt == "l"