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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: C = None
        self.u: F = None
        self.z: A = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: C = None
        self.u: F = None
        self.z: A = None
        self.y: E = None
        self.txt = txt

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

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

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

f.r = k
f.y = g
g.t = k
g.s = f
g.y = n
g.o = m
k.u = c
n.v = m
n.u = m
n.t = k
n.z = f
n.y = i
i.s = f
i.q = g
m.y = g
c.v = m
c.u = m
c.t = k
c.z = f
c.y = i
assert c.y.q.o.y.s.txt == "f"