class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: B = None
        self.v: E = None
        self.u: F = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

c = A("c")
a = B("a")
g = C("g")
m = D("m")
e = E("e")
n = F("n")

c.y = n
c.u = n
c.w = n
c.s = a
c.v = e
a.v = g
a.w = c
g.w = e
g.v = n
m.y = a
m.o = c
m.q = g
e.q = a
e.p = m
n.t = m
n.r = e
assert m.o.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: B = None
        self.v: E = None
        self.u: F = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

c = A("c")
a = B("a")
g = C("g")
m = D("m")
e = E("e")
n = F("n")

c.y = n
c.u = n
c.w = n
c.s = a
c.v = e
a.v = g
a.w = c
g.w = e
g.v = n
m.y = a
m.o = c
m.q = g
e.q = a
e.p = m
n.t = m
n.r = e
assert m.o.w.r.txt == "e"