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

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

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

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

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

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

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

n.r = k
n.u = k
n.o = g
n.v = a
k.r = n
k.u = n
k.p = a
c.v = g
g.o = f
a.w = c
a.v = k
f.o = k
assert n.v.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: D = None
        self.u: B = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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

n.r = k
n.u = k
n.o = g
n.v = a
k.r = n
k.u = n
k.p = a
c.v = g
g.o = f
a.w = c
a.v = k
f.o = k
assert n.v.w.v.txt == "g"