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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.v: D = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

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

a = A("a")
f = B("f")
m = C("m")
j = D("j")
g = E("g")
l = F("l")
k = E("k")

a.r = k
a.y = l
f.v = g
m.q = f
m.x = f
j.s = l
j.o = m
g.x = f
g.s = a
g.v = j
g.r = j
g.y = k
l.q = a
l.z = g
k.x = f
k.s = a
k.v = j
k.r = j
k.y = g
assert j.o.q.v.x.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: A = None
        self.v: D = None
        self.r: D = None
        self.y: E = None
        self.txt = txt

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

a = A("a")
f = B("f")
m = C("m")
j = D("j")
g = E("g")
l = F("l")
k = E("k")

a.r = k
a.y = l
f.v = g
m.q = f
m.x = f
j.s = l
j.o = m
g.x = f
g.s = a
g.v = j
g.r = j
g.y = k
l.q = a
l.z = g
k.x = f
k.s = a
k.v = j
k.r = j
k.y = g
assert j.o.q.v.x.v.x.v.txt == "g"