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

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.y: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: F = None
        self.q: D = None
        self.z: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.y: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: F = None
        self.q: D = None
        self.z: D = None
        self.txt = txt

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

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