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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: D = None
        self.r: G = None
        self.v: F = None
        self.o: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: A = None
        self.t: C = None
        self.w: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: B = None
        self.s: G = None
        self.txt = txt

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

a = A("a")
f = B("f")
c = C("c")
i = D("i")
e = E("e")
n = F("n")
b = G("b")
j = D("j")

a.r = c
a.q = c
a.o = f
f.v = a
f.t = c
c.p = i
c.w = j
c.r = b
c.o = b
c.v = n
i.q = b
i.w = b
i.x = a
i.t = c
e.z = f
n.r = f
n.v = f
n.s = b
b.y = n
j.q = b
j.w = b
j.x = a
j.t = c
assert a.o.v.o.v.q.r.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: B = None
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: D = None
        self.r: G = None
        self.v: F = None
        self.o: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: A = None
        self.t: C = None
        self.w: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: B = None
        self.s: G = None
        self.txt = txt

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

a = A("a")
f = B("f")
c = C("c")
i = D("i")
e = E("e")
n = F("n")
b = G("b")
j = D("j")

a.r = c
a.q = c
a.o = f
f.v = a
f.t = c
c.p = i
c.w = j
c.r = b
c.o = b
c.v = n
i.q = b
i.w = b
i.x = a
i.t = c
e.z = f
n.r = f
n.v = f
n.s = b
b.y = n
j.q = b
j.w = b
j.x = a
j.t = c
assert a.o.v.o.v.q.r.y.r.txt == "f"