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

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

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

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

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

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

m = A("m")
c = B("c")
l = C("l")
i = D("i")
k = E("k")
g = F("g")
d = F("d")

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

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

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

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

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

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

m = A("m")
c = B("c")
l = C("l")
i = D("i")
k = E("k")
g = F("g")
d = F("d")

m.o = l
c.s = d
c.p = i
c.o = m
l.q = d
l.z = g
l.p = k
i.w = c
k.r = g
k.v = c
k.u = c
k.w = i
k.t = m
k.q = d
g.y = d
g.s = d
g.r = d
g.o = k
g.p = c
d.y = g
d.s = g
d.r = g
d.o = k
d.p = c
assert m.o.q.p.txt == "c"